<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>

<%@ include file="/WEB-INF/jsp/common/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="<c:url value="/ui/jquery-1.10.2.js" />"></script>
<script src="<c:url value="/ui/jquery-migrate-1.2.1.js" />"></script>
<script src='<c:url value="/js/common.js" />'></script>
<script src='<c:url value="/js/common_ui.js" />'></script>
<script src='<c:url value="/js/poplayer.js" />'></script>
<script src='<c:url value="/js/maint_ui.js" />'></script>
<script src='<c:url value="/js/jquery.form.js" />'></script>
<meta http-equiv="Content-Type" content=" text/html;charset=UTF-8">
<title>loadIndex</title>
</head>
<body>
	<h3>loadIndex</h3>
	<form:form action="" method="post" enctype="multipart/form-data" id ="saveimage" >
		files:<input type="file" name="file" id ="file"> 
		<input type="hidden" name="moduleName" id="moduleName" value="employeeInfo">
		<input type="submit" class="imgSave" id="submit">
	</form:form>
	
	<p style="background: red">jack!tu<img alt="图片" src="<c:url value ="/"/>" id="img"></p>

	<script type="text/javascript">
		
			$(".imgSave").click(function(){
				$("#saveimage").attr("action","<c:url value='/attachment/upload' />")
				
				$("#saveimage").ajaxSubmit({
					dataType:'json',
					 success:function(msg){
						alert("msg")
						var newimg = msg.relativeFilePath;
						var id =  msg.id;
				       
				     $("#img").attr("src","<c:url value='/' />"+"attachment/"+id+"/downLoad");
				     
				      
				    }
				   }); 
				alert("jack!")
				   $("#file").val("");//清空文件域
				   return false; //防止刷新？
			})
	
	</script>
</body>
</html>